<template>
	<u-popup v-model="vuex_coin" mode="bottom" border-radius="20" @open="init" @close="cancel">
		<add-coin :slider="vuex_coin" :platform="platform" :applyId="applyId" @ok="ok" @cannel="cancel"></add-coin>
	</u-popup>
</template>

<script>
	import {mapState} from 'vuex';
	import addCoin from "@/components/coin-popup/addCoin";	//充值
	export default {
		components: {
			addCoin,
		},
		data() {
			return {
				login: {
					appId: '',
					encryptedData: '',
					code: '',
					iv: ''
				},
				platform: '',
			}
		},
		computed: {
			...mapState(['vuex_coin']),
		},
		methods: {
			init() {
				//加载激励广告
				//this.$utils.videoAdInit("adunit-bacaa86c865cf26b");
				var platform = uni.getStorageSync("platform");
				this.platform = platform;
				this.getAmount();
			},
			getAmount() {
				this.$u.get('/pay/userCoin/getAmountAndTuan',{
					appId: this.website.appId,
				}).then(res => {
					this.$store.commit('setAmount', res.amount);
					this.$store.commit('setTuan', res.isTuan);
				});
			},
			ok() {
				this.getAmount();
			},
			cancel() {
				this.$store.commit('setCoin', false);
				this.$store.commit('setCoinTip', '');
				this.$emit('close');
			},
		}
	}
</script>

<style lang="scss" scoped>
	.tip-info {
		font-size: 30rpx;
		display: flex;
		justify-content: center;
		color: #303133;
		margin-bottom: 15px;
	}
	.page {
		padding: 30px 15px;
	}
	.avatar-box {
		display: flex;
		justify-content: center;
		padding: 15px;
		padding-top: 0;
	}
</style>
